﻿using System.Threading.Tasks;

namespace Canteen.Core.Common
{
    public interface IWechat
    {
        public WechatGzhOptions Options { get; }

        /// <summary>
        /// 请求微信公众号-获取access_token（客户端凭证）
        /// </summary>
        /// <returns></returns>
        public Task<WechatResponseAccessToken> RequestWechatGzhAccessTokenAsync();
        /// <summary>
        /// 请求微信公众号授权-通过code换取网页授权access_token
        /// </summary>
        /// <param name="Code"></param>
        /// <returns></returns>
        public Task<WechatGzhResponseAccessToken> RequestWechatGzhAuthAccessTokenAsync(string Code);
        /// <summary>
        /// 请求微信公众号-刷新access_token（如果需要）
        /// </summary>
        /// <param name="RefreshToken"></param>
        /// <param name="Openid"></param>
        /// <returns></returns>
        public Task<WechatGzhResponseAccessToken> RefreshWechatGzhAccessTokenAsync(string RefreshToken);
        /// <summary>
        /// 请求微信公众号-拉取用户信息(需scope为 snsapi_userinfo)
        /// </summary>
        /// <param name="AccessToken"></param>
        /// <param name="Openid"></param>
        /// <returns></returns>
        public Task<WechatGzhResponseUserInfo> RequestWechatGzhUserInfoAsync(WechatGzhResponseAccessToken token);
        /// <summary>
        /// 请求微信公众号-检验授权凭证（access_token）是否有效
        /// </summary>
        /// <param name="AccessToken"></param>
        /// <param name="Openid"></param>
        /// <returns></returns>
        public Task<bool> RequestWechatGzhAccessTokenExistsAsync(string AccessToken, string Openid);
        /// <summary>
        /// 请求微信公众号  JS-SDK使用权限签名-获取jsapi_ticket临时票据
        /// </summary>
        /// <param name="AccessToken"></param>
        /// <returns></returns>
        public Task<WechatGzhResponseJSAPITicket> RequestWechatGzhJSAPITicket(string AccessToken);
    }
}
